home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
007
/
examples.arc
/
EXAMPL50.PRO
< prev
next >
Wrap
Text File
|
1986-10-07
|
564b
|
27 lines
/* program 50*/
/*
This program uses random to select three
names from five at random.
*/
predicates
person(integer,symbol)
rand_int_1_5(integer)
rand_person(integer)
goal
clearwindow,
rand_person(3).
clauses
person(1,fred).
person(2,tom).
person(3,mary).
person(4,dick).
person(5,george).
rand_int_1_5(X) :- random(Y),X=Y*4+1.
rand_person(0):-!.
rand_person(Count):-
rand_int_1_5(N),person(N,Name),nl,nl,write(Name),nl,
Newcount=Count-1,rand_person(NewCount).